package com.ebookfrenzy.viewmodeldemo.ui.main

import android.arch.lifecycle.ViewModel
import android.arch.lifecycle.MutableLiveData
class MainViewModel : ViewModel() {

    private val usd_to_eu_rate = 0.74f
    private var dollarText = ""
    private var result: MutableLiveData<Float> = MutableLiveData()


    fun setAmount(value: String) {
        this.dollarText = value
        result.setValue(value.toFloat() * usd_to_eu_rate)
    }

    fun getResult(): MutableLiveData<Float> {
        return result
    }

}
